package com.y.mytest.date;

import cn.hutool.core.date.*;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;

/**
 * @ClassName hutoDate
 * @Description
 * @Author YeZiHao
 * @Date 2022/9/1 15:09
 **/
public class hutoDate {
    public static void main(String[] args) {
        System.out.println(DateUtil.getChineseZodiac(2001));
        System.out.println(DateUtil.getZodiac(Month.JUNE.getValue(), 25));

        String s = "2022-12-15 16:10:03";
        System.out.println(DateUtil.parse(s));
        System.out.println(DateUtil.format(DateUtil.parse(s), DatePattern.NORM_DATE_PATTERN));

        System.out.println(DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(s)), DatePattern.NORM_DATE_PATTERN));
        System.out.println(DateUtil.endOfMonth(new Date()));

        System.out.println(DateUtil.format(DateUtil.lastWeek(), DatePattern.NORM_DATE_PATTERN));
        System.out.println(DateUtil.format(DateUtil.lastMonth(), DatePattern.NORM_DATE_PATTERN));
        System.out.println(DateUtil.format(DateUtil.offset(new Date(), DateField.MONTH, -6), DatePattern.NORM_DATE_PATTERN));
    }
}
